﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="createprocedure.aspx.cs" Inherits="CSP.CRM.ISVExtensions.CreateProcedurePage"  %>
<%@ OutputCache Duration='6000' VaryByParam="none" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>CSP</title>
<script type="text/javascript">


// These variables are initialized in a server-generated block
var contactid;
var openProcedureUrl;
var selectedEntityTypeCode;

function openNewProcedure()
{
window.open(openProcedureUrl + "&amp;etc=" + selectedEntityTypeCode , 'wNewProcedure', 'width=800,height=600');
setTimeout('self.close();', 100);
}


var numItems;
function getProcedureCount()
{
 numItems = document.getElementById("divProcedures").childNodes.length;
}


function enterItem(item)
{
item.style.backgroundColor = '#FEE59F';
item.style.borderColor = '#FFB74C';
}

function leaveItem(item)
{
 if (item.className != "selecteditem")
 {
 item.style.backgroundColor = '#FFFFFF';
 item.style.borderColor = '#FFFFFF';
 }
}

function selectItem(item)
{
  for (i = 1; i <= numItems; i++)
  {
    otheritem = document.getElementById("itProcedure" + i);
    if (otheritem == item)
    {
    item.className = "selecteditem";
    item.style.backgroundColor = '#FEE59F';
    item.style.borderColor = '#FFB74C';
    }
    else
    {
    otheritem.className = "item";
    otheritem.style.backgroundColor = '#FFFFFF';
    otheritem.style.borderColor = '#FFFFFF';
    }
  }
  selectedEntityTypeCode = item.firstChild.value;
}
</script>

<style type="text/css">
.header { height: 50px; background-color: #6693cf; padding: 0 8 8 8; position: absolute; left:0; top:0; width:280px;}
.body { height: 240px; background-color: #EAF3FF; padding: 8 8 8 8; position: absolute; left:0; top:50;width:280px;}
.menu { height: 220px;background-color: #ffffff; border: solid 1px #6699CC;}
.footer { padding-left:100px; padding-top: 12px;height: 60px; background-color: #e3efff; position: absolute; left:0; top:290;width:280px;}
div { font: regular 11pt tahoma; color: #FFFFFF;}
div.title { font: bold 14pt tahoma; color: #FFFFFF;}
div.subtitle { font: 8pt tahoma; color: #FFFFFF;}
div.item { background-color: #FFFFFF;padding: 2 0 0 2; width:100%;border-bottom: solid 1px lightgray;border-top: solid 1px lightgray;}
div.selecteditem { background-color: red; padding: 2 0 0 2; width:100%;border-bottom: solid 1px #FFB74C;border-top: solid 1px #FFB74C;}
span.itemicon {  width:18px; vertical-align:middle;height: 18px; }
span.itemtext { font: 11px tahoma; color: #3366CC; height: 18px;	}
input { font: 11px tahoma; height:22px; width:84px; border-color:#a7cdf0; background-color: #a7cdf0; }
</style>

</head>
<body onload="getProcedureCount();">
<form id="frm" runat="server">    
<div class="header">
<div class='title'><%=csp.GetConfigText("ChooseProcedureTitle")%></div>
<div class='subtitle'><%=csp.GetConfigText("ChooseProcedureSubtitle")%></div>
</div>

<div class='body'>
<div class='menu' id='divProcedures'>
<asp:Repeater ID="repProcedures" runat="server" >
<ItemTemplate>
<div id='itProcedure<%# Container.ItemIndex + 1 %>' class='item' onmouseover='enterItem(this);' onmouseout='leaveItem(this)' onclick='selectItem(this)'>
  <input type='hidden' id='hProcedureType<%# Container.ItemIndex + 1 %>' value='<%# Eval("EntityTypeCode") %>'/>
	<span class='itemicon'><img src="ico_16_112.gif" alt='<%#Eval("EntityName")%>'/></span>
	<span class='itemtext'><%#Eval("EntityName")%></span>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
</div>

<div class='footer'>
<input type='button' value='OK' onclick='openNewProcedure();'/>
<input type='button' value='<%=csp.GetConfigText("CancelText") %>' onclick='window.close();'/>
</div>


</form>
</body>
</html>
